#ifndef SEQIOT_SLAVE_HANDLER_H
#define SEQIOT_SLAVE_HANDLER_H

#include <cs104_slave.h>

typedef struct _iec104_params_t {
    __time_t sched_time;
    seqiot_t *seqiot;
    //104传输原因
    CS101_CauseOfTransmission cot;
    //104数据是否带时间戳
    _Bool with_timestamp;
} iec104_params_t;

bool connection_request_handler(void *parameter, const char *ip_addr);

void connection_event_handler(void *parameter, IMasterConnection conn, CS104_PeerConnectionEvent event);

void raw_message_handler(void *parameter, IMasterConnection conn, uint8_t *msg, int size, bool sent);

bool clock_sync_handler(void *parameter, IMasterConnection connection, CS101_ASDU asdu, CP56Time2a time);

bool interrogation_handler(void *parameter, IMasterConnection connection, CS101_ASDU asdu, uint8_t qoi);

bool counter_interrogation_handler(void *parameter, IMasterConnection connection, CS101_ASDU asdu, QualifierOfCIC qcc);

int iec104_asdu_write(struct _pub_handler_t *handler, device_t *device, segment_e segment);

int iec104_asdu_flush(struct _pub_handler_t *handler);

#endif //SEQIOT_SLAVE_HANDLER_H
